package frist50;

import org.junit.jupiter.api.Test;

public class T0028 {
    public int strStr(String haystack, String needle) {
        int inddex=-1;
        int len=haystack.length();
        int i = 0;
        while (haystack.length()>=needle.length()) {
            if (haystack.startsWith(needle)){
                inddex=i;
                break;
            }
            haystack=haystack.substring(1);
            i++;
        }
        return inddex;
    }

    @Test
    public void test() {

        String hay="12sadbutsad";
        String nee="sad";
        System.out.println(strStr(hay,nee));

    }
}
